<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" label-width="140px">
            <el-form-item label="岗位名称" prop="postName">
                <el-input v-model="queryParams.postName" placeholder="请输入岗位名称" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="设岗部门" prop="deptName">
                <el-input v-model="queryParams.deptName" placeholder="请输入设岗部门" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="负责人姓名" prop="fzrName">
                <el-input v-model="queryParams.fzrName" placeholder="请输入负责人姓名" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="指导老师姓名" prop="zdlsName">
                <el-input v-model="queryParams.zdlsName" placeholder="请输入指导老师姓名" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="审核状态" prop="applyStatus">
                <el-select v-model="queryParams.applyStatus" placeholder="请选择审核状态" clearable>
                    <el-option v-for="dict in dict.type.qgzx_stu_post_status" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                </el-select>
            </el-form-item>
            <el-form-item label="申请时间" prop="applyTime">
                <el-date-picker clearable v-model="queryParams.applyTime" type="date" value-format="yyyy-MM-dd"
                    placeholder="请选择申请时间">
                </el-date-picker>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>

        <el-table v-loading="loading" :data="tableData">
            <el-table-column label="#" align="center" prop="id" />
            <el-table-column label="岗位名称" align="center" prop="postName" />
            <el-table-column label="设岗部门" align="center" prop="deptName" />

            <el-table-column label="审核状态" align="center" prop="applyStatus">
                <template slot-scope="scope">
                    <dict-tag :options="dict.type.qgzx_stu_post_status" :value="scope.row.applyStatus" />
                </template>
            </el-table-column>
            <el-table-column label="是否在岗" align="center" prop="workStatus" />
            <el-table-column label="申请时间" align="center" prop="applyTime" width="180">
                <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.applyTime) }}</span>
                </template>
            </el-table-column>

            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                    <el-button v-if="scope.row.applyStatus == '0'" size="mini" type="text" icon="el-icon-edit"
                        @click="doEdit(scope.row)">修改</el-button>
                    <el-button v-if="scope.row.applyStatus == '1' || scope.row.applyStatus == '0'" size="mini"
                        type="text" icon="el-icon-circle-close" @click="cancelApply(scope.row)">取消申请</el-button>
                    <el-button v-if="scope.row.applyStatus != '0'" size="mini" type="text" icon="el-icon-view"
                        @click="lookVClick(scope.row)">查看</el-button>
                    <el-button v-if="scope.row.applyStatus == '11'" size="mini" type="text" icon="el-icon-refresh"
                        @click="reVClick(scope.row)">重新提交</el-button>
                </template>
            </el-table-column>
        </el-table>



        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize" @pagination="getList" />


        <el-dialog title="修改" :visible.sync="editV" append-to-body fullscreen>
            <el-form class="lookForm" size="mini" ref="applyForm" label-width="148px">
                <el-row>
                    <el-col :span="8">
                        <el-form-item label="身份证号">
                            <el-input v-model="applyForm.idCard" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="农行卡号">
                            <el-input v-model="applyForm.bankCard" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="开户行">
                            <el-input v-model="applyForm.bankAddr" />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="联系电话">
                            <el-input v-model="applyForm.stuPhone" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="课余时间(单位：小时)">
                            <el-input type="number" v-model="applyForm.canTime" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="家庭地址">
                            <el-input v-model="applyForm.familyAddr" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="宿舍">
                            <el-input v-model="applyForm.stuDorm" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="家庭经济情况">
                            <el-select v-model="applyForm.familyCondition">
                                <el-option :label="'特别困难'" :value="'特别困难'"></el-option>
                                <el-option :label="'比较困难'" :value="'比较困难'"></el-option>
                                <el-option :label="'一般困难'" :value="'一般困难'"></el-option>
                                <el-option :label="'不困难'" :value="'不困难'"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="指导老师" prop="zdlsName">
                            <TeacherSelect :valueProps="{ value: 'employeeId', label: 'name' }"
                                v-model="applyForm.zdlsNo" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="曾获得资助">
                            <el-input type="textarea" v-model="applyForm.helpHis" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="申请原因">
                            <el-input type="textarea" v-model="applyForm.applyReason" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="申请附件">
                            <file-upload :fileType="[' doc', 'xls', 'ppt', 'txt', 'pdf', 'xlsx', 'png', 'jpg', 'jpeg', 'bmp'
                            ]" v-model="applyForm.applyMaterial"></file-upload>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="申请人签字">
                            <el-upload :limit="1" class="avatar-uploader" :action="upload.url" :headers="upload.headers"
                                :show-file-list="false" :on-success="handleAvatarSuccess">
                                <img v-if="applyForm.applySign" :src="baseurl + applyForm.applySign" width="200px"
                                    height="50px" class="avatar">
                                <span v-else> 点击上传</span>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-button size="mini" type="primary" plain @click="doSave">保存</el-button>
                        <el-button size="mini" type="success" plain @click="doApply">提交</el-button>
                    </el-col>

                </el-row>

            </el-form>
            <hr />
            <el-form class="lookForm" size="mini" ref="lookForm" label-width="148px">
                <el-row>
                    <el-col :span="8">
                        <el-form-item label="岗位名称" prop="postName">
                            <el-input v-model="lookForm.postName" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="设岗部门" prop="deptId">
                            <el-input v-model="lookForm.deptName" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="设岗人数" prop="postCount">
                            <el-input v-model="lookForm.postCount" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="负责人" prop="fzrName">
                            <el-input v-model="lookForm.fzrName" readonly />
                        </el-form-item>
                    </el-col>



                    <el-col :span="8">
                        <el-form-item label="联系电话" prop="zdlsPhone">
                            <el-input v-model="lookForm.zdlsPhone" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="付酬方式">
                            <el-input value="按小时" disabled />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="付酬标准">
                            <el-input value="15.00" disabled />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="预计金额(元/月/人)" prop="willMoney">
                            <el-input v-model="lookForm.willMoney" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="12">
                        <el-form-item label="预计金额合计(元/月)" prop="willMoneyTotal">
                            <el-input readonly v-model="lookForm.willMoneyTotal" />
                        </el-form-item>
                    </el-col>

                    <el-col :span="24">
                        <el-form-item label="岗位职责" prop="workNeed">
                            <el-input type="textarea" v-model="lookForm.workNeed" readonly />
                        </el-form-item>
                    </el-col>


                    <el-col :span="24">
                        <el-form-item label="技能要求" prop="skillNeed">
                            <el-input type="textarea" v-model="lookForm.skillNeed" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="24">
                        <el-form-item label="每周工作时长" prop="weekTime">
                            <el-input v-model="lookForm.weekTime" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="校区" prop="campusName">
                            <el-input v-model="lookForm.campusName" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="16">
                        <el-form-item label="工作地点" prop="workAddr">
                            <el-input v-model="lookForm.workAddr" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="岗位类型" prop="postType">
                            <el-input v-model="lookForm.postType" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="备注" prop="remark">
                            <el-input v-model="lookForm.remark" readonly />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>

        </el-dialog>



        <el-dialog title="查看" :visible.sync="lookV" append-to-body fullscreen>
            <el-steps :active="getStep(applyForm)">
                <el-step title="学生申请入驻岗位" description=""></el-step>

                <el-step title="辅导员审批" :status="isEmpty(applyForm.fdyCmt) ? 'wait' : getStepStatus(applyForm.fdyCmt)">
                    <template slot="description">
                        <div>
                            {{ isEmpty(applyForm.fdyName) ? '' : applyForm.fdyName }}
                        </div>
                        <div>
                            {{ isEmpty(applyForm.fdyCmt) ? '' : applyForm.fdyCmt }}
                        </div>
                        <div>
                            {{ isEmpty(applyForm.fdyTime) ? '' : applyForm.fdyTime }}
                        </div>
                    </template>
                </el-step>

                <el-step title="指导老师审批"
                    :status="isEmpty(applyForm.zdlsCmt) ? 'wait' : getStepStatus(applyForm.zdlsCmt)">
                    <template slot="description">
                        <div>
                            {{ isEmpty(applyForm.zdlsName) ? '' : applyForm.zdlsName }}
                        </div>
                        <div>
                            {{ isEmpty(applyForm.zdlsCmt) ? '' : applyForm.zdlsCmt }}
                        </div>
                        <div>
                            {{ isEmpty(applyForm.zdlsTime) ? '' : applyForm.zdlsTime }}
                        </div>
                    </template>
                </el-step>

                <el-step title="资助办领导审批" :status="isEmpty(applyForm.zzbCmt) ? 'wait' : getStepStatus(applyForm.zzbCmt)">
                    <template slot="description">
                        <div>
                            {{ isEmpty(applyForm.zzbName) ? '' : applyForm.zzbName }}
                        </div>
                        <div>
                            {{ isEmpty(applyForm.zzbCmt) ? '' : applyForm.zzbCmt }}
                        </div>
                        <div>
                            {{ isEmpty(applyForm.zzbTime) ? '' : applyForm.zzbTime }}
                        </div>
                    </template>
                </el-step>
            </el-steps>
            <hr />
            <el-form class="lookForm" size="mini" ref="auditForm" label-width="148px">
                <el-row>
                    <el-col :span="4">
                        <el-form-item label="审核意见">
                            <el-radio-group disabled v-model="applyForm.fdyCmt">
                                <el-radio :label="'通过'">通过</el-radio>
                                <el-radio :label="'不通过'">不通过</el-radio>
                                <el-radio :label="'驳回'">驳回</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="辅导员签章">
                            <img v-if="applyForm.fdySign" :src="baseurl + applyForm.fdySign" width="150px" height="50px"
                                class="avatar">
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="审核意见">
                            <el-radio-group disabled v-model="applyForm.zdlsCmt">
                                <el-radio :label="'通过'">通过</el-radio>
                                <el-radio :label="'不通过'">不通过</el-radio>
                                <el-radio :label="'驳回'">驳回</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="指导老师签章">
                            <img v-if="applyForm.zdlsSign" :src="baseurl + applyForm.zdlsSign" width="150px"
                                height="50px" class="avatar">
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="审核意见">
                            <el-radio-group disabled v-model="applyForm.zzbCmt">
                                <el-radio :label="'通过'">通过</el-radio>
                                <el-radio :label="'不通过'">不通过</el-radio>
                                <el-radio :label="'驳回'">驳回</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="资助办领导签章">
                            <img v-if="applyForm.zdlsSign" :src="baseurl + applyForm.zzbSign" width="150px"
                                height="50px" class="avatar">
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <hr />
            <el-form class="lookForm" size="mini" ref="applyForm" label-width="148px">
                <el-row>
                    <el-col :span="8">
                        <el-form-item label="学号">
                            <el-input readonly v-model="applyForm.stuNo" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="姓名">
                            <el-input readonly v-model="applyForm.stuName" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="身份证号">
                            <el-input readonly v-model="applyForm.idCard" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="农行卡号">
                            <el-input readonly v-model="applyForm.bankCard" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="开户行">
                            <el-input readonly v-model="applyForm.bankAddr" />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="联系电话">
                            <el-input readonly v-model="applyForm.stuPhone" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="课余时间(单位：小时)">
                            <el-input readonly v-model="applyForm.canTime" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="家庭地址">
                            <el-input readonly v-model="applyForm.familyAddr" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="宿舍">
                            <el-input readonly v-model="applyForm.stuDorm" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="家庭经济情况">
                            <el-input readonly v-model="applyForm.familyCondition"></el-input>
                        </el-form-item>
                    </el-col>


                    <el-col :span="8">
                        <el-form-item label="指导老师" prop="zdlsName">
                            <el-input v-model="applyForm.zdlsName" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="12">
                        <el-form-item label="曾获得资助">
                            <el-input readonly type="textarea" v-model="applyForm.helpHis" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="申请原因">
                            <el-input readonly type="textarea" v-model="applyForm.applyReason" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="申请附件">
                            <div v-if="!isEmpty(applyForm.applyMaterial)">
                                <div v-for="(v, i) in applyForm.applyMaterial.split(',')" :key="i">
                                    <a style="text-decoration: underline; color: blue;" :href="baseurl + v"
                                        :download="v.split('/').pop()">{{ v.split("/").pop() }}</a>
                                </div>
                            </div>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="申请人签字">
                            <img v-if="applyForm.applySign" :src="baseurl + applyForm.applySign" width="200px"
                                height="50px" class="avatar">
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" v-if="!isEmpty(applyForm.returnMsg)">
                        <el-form-item label="驳回原因">
                            <el-input readonly type="textarea" v-model="applyForm.returnMsg" />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <hr />
            <el-form class="lookForm" size="mini" ref="lookForm" label-width="148px">
                <el-row>
                    <el-col :span="8">
                        <el-form-item label="岗位名称" prop="postName">
                            <el-input v-model="lookForm.postName" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="设岗部门" prop="deptId">
                            <el-input v-model="lookForm.deptName" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="设岗人数" prop="postCount">
                            <el-input v-model="lookForm.postCount" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="负责人" prop="fzrName">
                            <el-input v-model="lookForm.fzrName" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="联系电话" prop="zdlsPhone">
                            <el-input v-model="lookForm.zdlsPhone" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="付酬方式">
                            <el-input value="按小时" disabled />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="付酬标准">
                            <el-input value="15.00" disabled />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="预计金额(元/月/人)" prop="willMoney">
                            <el-input v-model="lookForm.willMoney" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="12">
                        <el-form-item label="预计金额合计(元/月)" prop="willMoneyTotal">
                            <el-input readonly v-model="lookForm.willMoneyTotal" />
                        </el-form-item>
                    </el-col>

                    <el-col :span="24">
                        <el-form-item label="岗位职责" prop="workNeed">
                            <el-input type="textarea" v-model="lookForm.workNeed" readonly />
                        </el-form-item>
                    </el-col>


                    <el-col :span="24">
                        <el-form-item label="技能要求" prop="skillNeed">
                            <el-input type="textarea" v-model="lookForm.skillNeed" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="24">
                        <el-form-item label="每周工作时长" prop="weekTime">
                            <el-input v-model="lookForm.weekTime" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="校区" prop="campusName">
                            <el-input v-model="lookForm.campusName" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="16">
                        <el-form-item label="工作地点" prop="workAddr">
                            <el-input v-model="lookForm.workAddr" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="岗位类型" prop="postType">
                            <el-input v-model="lookForm.postType" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="备注" prop="remark">
                            <el-input v-model="lookForm.remark" readonly />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>

        </el-dialog>


        <el-dialog title="重新提交" :visible.sync="replyV" append-to-body fullscreen>
            <el-form class="lookForm" size="mini" ref="replyForm" label-width="148px">
                <el-row>

                    <el-col :span="8">
                        <el-form-item label="身份证号" prop="idCard">
                            <el-input v-model="replyForm.idCard" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="农行卡号" prop="bankCard">
                            <el-input v-model="replyForm.bankCard" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="开户行" prop="bankAddr">
                            <el-input v-model="replyForm.bankAddr" />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="联系电话" prop="stuPhone">
                            <el-input v-model="replyForm.stuPhone" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="课余时间(单位：小时)" prop="canTime">
                            <el-input type="number" v-model="replyForm.canTime" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="家庭地址" prop="familyAddr">
                            <el-input v-model="replyForm.familyAddr" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="宿舍" prop="stuDorm">
                            <el-input v-model="replyForm.stuDorm" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="家庭经济情况" prop="familyCondition">
                            <el-select v-model="replyForm.familyCondition">
                                <el-option :label="'特别困难'" :value="'特别困难'"></el-option>
                                <el-option :label="'比较困难'" :value="'比较困难'"></el-option>
                                <el-option :label="'一般困难'" :value="'一般困难'"></el-option>
                                <el-option :label="'不困难'" :value="'不困难'"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="指导老师" prop="zdlsNo">
                            <TeacherSelect :valueProps="{ value: 'employeeId', label: 'name' }"
                                v-model="replyForm.zdlsNo" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="曾获得资助" prop="helpHis">
                            <el-input type="textarea" v-model="replyForm.helpHis" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="申请原因" prop="applyReason">
                            <el-input type="textarea" v-model="replyForm.applyReason" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="申请附件" prop="applyMaterial">
                            <file-upload :fileType="[' doc', 'xls', 'ppt', 'txt', 'pdf', 'xlsx', 'png', 'jpg', 'jpeg', 'bmp'
                            ]" v-model="replyForm.applyMaterial"></file-upload>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="申请人签字" prop="applySign">
                            <el-upload :limit="1" class="avatar-uploader" :action="upload.url" :headers="upload.headers"
                                :show-file-list="false" :on-success="handleAvatarSuccess">
                                <img v-if="replyForm.applySign" :src="baseurl + replyForm.applySign" width="200px"
                                    height="50px" class="avatar">
                                <span v-else> 点击上传</span>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-button size="mini" type="success" plain @click="doReply">重新提交</el-button>
                    </el-col>

                </el-row>

            </el-form>
            <hr />
            <el-form class="lookForm" size="mini" ref="lookForm" label-width="148px">
                <el-row>
                    <el-col :span="8">
                        <el-form-item label="岗位名称" prop="postName">
                            <el-input v-model="lookForm.postName" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="设岗部门" prop="deptId">
                            <el-input v-model="lookForm.deptName" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="设岗人数" prop="postCount">
                            <el-input v-model="lookForm.postCount" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="负责人" prop="fzrName">
                            <el-input v-model="lookForm.fzrName" readonly />
                        </el-form-item>
                    </el-col>

                    <!-- <el-col :span="8">
                        <el-form-item label="指导老师" prop="zdlsName">
                            <el-input v-model="lookForm.zdlsName" readonly />
                        </el-form-item>
                    </el-col> -->

                    <el-col :span="8">
                        <el-form-item label="联系电话" prop="zdlsPhone">
                            <el-input v-model="lookForm.zdlsPhone" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="付酬方式">
                            <el-input value="按小时" disabled />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="付酬标准">
                            <el-input value="15.00" disabled />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="预计金额(元/月/人)" prop="willMoney">
                            <el-input v-model="lookForm.willMoney" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="12">
                        <el-form-item label="预计金额合计(元/月)" prop="willMoneyTotal">
                            <el-input readonly v-model="lookForm.willMoneyTotal" />
                        </el-form-item>
                    </el-col>

                    <el-col :span="24">
                        <el-form-item label="岗位职责" prop="workNeed">
                            <el-input type="textarea" v-model="lookForm.workNeed" readonly />
                        </el-form-item>
                    </el-col>


                    <el-col :span="24">
                        <el-form-item label="技能要求" prop="skillNeed">
                            <el-input type="textarea" v-model="lookForm.skillNeed" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="24">
                        <el-form-item label="每周工作时长" prop="weekTime">
                            <el-input v-model="lookForm.weekTime" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="校区" prop="campusName">
                            <el-input v-model="lookForm.campusName" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="16">
                        <el-form-item label="工作地点" prop="workAddr">
                            <el-input v-model="lookForm.workAddr" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="岗位类型" prop="postType">
                            <el-input v-model="lookForm.postType" readonly />
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="备注" prop="remark">
                            <el-input v-model="lookForm.remark" readonly />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>

        </el-dialog>




    </div>
</template>
<script>
import TeacherSelect from '@/views/components/TeacherSelect/index';

import { stuGetPost } from "@/api/workstudy/post";
import { cancelApply, doApply, doReply, doSave, listOwnApply as getList, getOwnFdyName } from "@/api/workstudy/stuPost";

import { CheckImgExists, fullLoading, isEmpty } from "@/api/helpFunc";
import { alipayVali } from "@/api/helpFunc/bank";
import { getToken } from "@/utils/auth";

export default {
    name: "workstudy-StuPost-stu",
    dicts: ['qgzx_stu_post_status'],
    components: { TeacherSelect },
    data() {
        return {
            isEmpty,
            loading: false,

            tableData: [],
            total: 0,
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                postName: null
            },


            editV: false,
            lookForm: {},
            applyForm: {},

            upload: {
                headers: { Authorization: "Bearer " + getToken() },
                // 上传的地址
                url: process.env.VUE_APP_BASE_API + "/common/upload"
            },
            baseurl: process.env.VUE_APP_BASE_API + "/",

            lookV: false,


            replyV: false,
            replyForm: {}, //重新提交表单
        }
    },
    created() {
        this.getList();
    },
    methods: {

        //此方法用于判断步骤条当前步骤的状态
        getStepStatus(data) {
            if (data == "通过") {
                return 'success';
            } else {
                return 'error';
            }
        },

        //此方法用于判断步骤条到哪个步骤了
        getStep(data) {
            if (!isEmpty(data.zzbCmt)) { //判断资助办领导有没有审批
                return 4;
            } else if (!isEmpty(data.zdlsCmt)) { //判断指导老师有没有审批
                return 3;
            } else if (!isEmpty(data.fdyCmt)) { //判断辅导员有没有审批
                return 2;
            } else {
                return 1;
            }
        },


        //此方法用于重新提交
        async doReply() {

            let sdata = { ...this.replyForm };

            if (isEmpty(sdata.zdlsNo)) {
                this.$message.info("请选择指导老师");
                return;
            }
            if (isEmpty(sdata.idCard)) {
                this.$message.info("请填写身份证号");
                return;
            }
            if (isEmpty(sdata.bankCard)) {
                this.$message.info("请填写农行卡号");
                return;
            }
            if (isEmpty(sdata.bankAddr)) {
                this.$message.info("请填写开户行");
                return;
            }
            if (isEmpty(sdata.stuPhone)) {
                this.$message.info("请填写联系电话");
                return;
            }
            if (isEmpty(sdata.canTime)) {
                this.$message.info("请填写课余时间");
                return;
            }
            if (isEmpty(sdata.familyAddr)) {
                this.$message.info("请填写家庭地址");
                return;
            }

            if (isEmpty(sdata.zdlsNo)) {
                this.$message.info("请选择指导老师");
                return;
            }

            if (isEmpty(sdata.stuDorm)) {
                this.$message.info("请填写宿舍");
                return;
            }
            if (isEmpty(sdata.familyCondition)) {
                this.$message.info("请选择家庭经济情况");
                return;
            }
            if (isEmpty(sdata.applyReason)) {
                this.$message.info("请填写申请原因");
                return;
            }
            if (isEmpty(sdata.applySign)) {
                this.$message.info("请上传签字");
                return;
            }

            if (!CheckImgExists(this.baseurl + sdata.applySign)) {
                this.$message.info("签名失效，请重新上传");
                return;
            }

            let loading = fullLoading(this);
            let res = await doReply(sdata);
            loading.close();
            if (res.code == 200) {
                this.getList();
                this.$message.success(res.msg);
                this.replyV = false;
            }
        },

        //点击重新提交
        async reVClick(row) {
            this.replyForm = {};
            this.replyForm = { ...row };

            this.lookForm = {};
            let loading = fullLoading(this);
            let res = await stuGetPost(row.postId);
            loading.close();
            if (res.code == 200) {
                this.lookForm = { ...res.data };
                this.lookForm.deptName = row.deptName;
                this.lookForm.zdlsName = row.zdlsName; //指导老师姓名

                this.replyV = true;
            }
        },

        async lookVClick(row) {
            this.applyForm = {};

            this.lookForm = {};
            this.applyForm = { ...row };
            let loading = fullLoading(this);
            let res = await stuGetPost(row.postId);
            loading.close();
            let loading1 = fullLoading(this);
            let res1 = await getOwnFdyName();
            loading1.close();
            if (res1.code == 200) {
                this.applyForm.fdyName = res1.data.fdyName;
            }
            if (res.code == 200) {
                this.lookForm = { ...res.data };
                this.lookForm.deptName = row.deptName;
                this.lookForm.zdlsName = row.zdlsName; //指导老师姓名

                this.lookV = true;
            }
        },
        async doEdit(row) {
            this.applyForm = {};
            this.lookForm = {};
            this.applyForm = { ...row };
            let loading = fullLoading(this);
            let res = await stuGetPost(row.postId);
            loading.close();
            if (res.code == 200) {
                this.lookForm = { ...res.data };
                this.lookForm.deptName = row.deptName;
                this.lookForm.zdlsName = row.zdlsName; //指导老师姓名

                this.editV = true;
            }
        },
        async doSave() {
            let sdata = { ...this.applyForm };
            if (isEmpty(sdata.zdlsNo)) {
                this.$message.info("请选择指导老师");
                return;
            }
            if (isEmpty(sdata.idCard)) {
                this.$message.info("请填写身份证号");
                return;
            }
            if (isEmpty(sdata.bankCard)) {
                this.$message.info("请填写农行卡号");
                return;
            }
            if (isEmpty(sdata.bankAddr)) {
                this.$message.info("请填写开户行");
                return;
            }
            if (isEmpty(sdata.stuPhone)) {
                this.$message.info("请填写联系电话");
                return;
            }
            if (isEmpty(sdata.canTime)) {
                this.$message.info("请填写课余时间");
                return;
            }
            if (isEmpty(sdata.familyAddr)) {
                this.$message.info("请填写家庭地址");
                return;
            }

            if (isEmpty(sdata.zdlsNo)) {
                this.$message.info("请选择指导老师");
                return;
            }

            if (isEmpty(sdata.stuDorm)) {
                this.$message.info("请填写宿舍");
                return;
            }
            if (isEmpty(sdata.familyCondition)) {
                this.$message.info("请选择家庭经济情况");
                return;
            }
            if (isEmpty(sdata.applyReason)) {
                this.$message.info("请填写申请原因");
                return;
            }
            if (isEmpty(sdata.applySign)) {
                this.$message.info("请上传签字");
                return;
            }

            if (!CheckImgExists(this.baseurl + sdata.applySign)) {
                this.$message.info("签名失效，请重新上传");
                return;
            }

            let card = sdata.bankCard;
            let loading = fullLoading(this);
            let boolCard = await alipayVali(card);
            loading.close();
            if (boolCard.validated == false) {
                this.$message.info("请输入正确的银行卡号");
                return;
            }

            if (boolCard.bank != "ABC") {
                this.$message.info("请输入正确的中国农业银行银行卡号");
                return;
            }

            if (isEmpty(sdata.helpHis)) {
                sdata.helpHis = "无";
            }

            let loading1 = fullLoading(this);
            let res = await doSave(sdata);
            loading1.close();
            if (res.code == 200) {
                this.getList();
                this.editV = false;
                this.$message.success(res.msg);
            }

        },
        async doApply() {
            let sdata = { ...this.applyForm };
            if (isEmpty(sdata.zdlsNo)) {
                this.$message.info("请选择指导老师");
                return;
            }
            if (isEmpty(sdata.idCard)) {
                this.$message.info("请填写身份证号");
                return;
            }
            if (isEmpty(sdata.bankCard)) {
                this.$message.info("请填写农行卡号");
                return;
            }
            if (isEmpty(sdata.bankAddr)) {
                this.$message.info("请填写开户行");
                return;
            }
            if (isEmpty(sdata.stuPhone)) {
                this.$message.info("请填写联系电话");
                return;
            }
            if (isEmpty(sdata.canTime)) {
                this.$message.info("请填写课余时间");
                return;
            }
            if (isEmpty(sdata.familyAddr)) {
                this.$message.info("请填写家庭地址");
                return;
            }
            if (isEmpty(sdata.stuDorm)) {
                this.$message.info("请填写宿舍");
                return;
            }
            if (isEmpty(sdata.familyCondition)) {
                this.$message.info("请选择家庭经济情况");
                return;
            }
            if (isEmpty(sdata.applyReason)) {
                this.$message.info("请填写申请原因");
                return;
            }
            if (isEmpty(sdata.applySign)) {
                this.$message.info("请上传签字");
                return;
            }

            if (!CheckImgExists(this.baseurl + sdata.applySign)) {
                this.$message.info("签名失效，请重新上传");
                return;
            }

            let card = sdata.bankCard;
            let loading = fullLoading(this);
            let boolCard = await alipayVali(card);
            loading.close();
            if (boolCard.validated == false) {
                this.$message.info("请输入正确的银行卡号");
                return;
            }

            if (boolCard.bank != "ABC") {
                this.$message.info("请输入正确的中国农业银行银行卡号");
                return;
            }

            if (isEmpty(sdata.helpHis)) {
                sdata.helpHis = "无";
            }

            let loading1 = fullLoading(this);
            let res = await doApply(sdata);
            loading1.close();
            if (res.code == 200) {
                this.getList();
                this.editV = false;
                this.$message.success(res.msg);
            }
        },

        handleAvatarSuccess(response, file, fileList) {
            this.applyForm.applySign = response.fileName;
            this.$forceUpdate();
        },


        cancelApply(row) {
            let id = row.id;
            this.$confirm('您确定要取消该岗位的申请吗, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(async () => {
                let loading = fullLoading(this);
                let res = await cancelApply(id);
                loading.close();
                if (res.code == 200) {
                    this.$message.success(res.msg);
                    this.getList();
                }
            }).catch(() => {

            });
        },

        async getList() {
            this.loading = true;
            let res = await getList(this.queryParams);
            this.loading = false;
            if (res.code == 200) {
                this.tableData = [...res.rows];
                this.total = res.total;
            }
        },
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        resetQuery() {
            this.resetForm("queryForm");
            this.handleQuery();
        },
    }
}



</script>


<style scoped lang="scss">
.lookForm {
    .el-form-item {
        margin-bottom: 5px;
    }
}
</style>